﻿<%@ Page Language="C#" MasterPageFile="~/ad/AdminFShop.master" AutoEventWireup="true" CodeFile="ManageAdvertise.aspx.cs" Inherits="ManageAdvertise" Title="List Advertise" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<!--Start add new-->
	<tr  style="width:100%;">
	   <td align="right">
		  <a href="EditAdvertise.aspx"><img src="Images/list.gif" width="18" border="0" height="18" alt="Thêm mới quảng cáo"/>Thêm mới</a>            
	   </td>        
	</tr>
	<!--End add new-->
	<tr>
		<td valign="top" style="width:100%;" >
		<asp:GridView ID="grdAdvertise" runat="server" AllowPaging="True" 
			AutoGenerateColumns="False" DataKeyNames="Adv_ID" Width="100%"
			ForeColor="Black" BorderStyle="None" BorderWidth="1px"
			CellPadding="4" GridLines="Vertical" OnRowDataBound="grdAdvertise_RowDataBound" 
			OnPageIndexChanging="grdAdvertise_PageIndexChanging" 
                OnRowCommand="grdAdvertise_RowCommand" BackColor="White" BorderColor="#DEDFDE">
			<Columns>        
				 <asp:TemplateField>
					<ItemStyle HorizontalAlign="Center" />
					<ItemTemplate>
						<asp:CheckBox ID="chkCheck" runat="server" />                               
					</ItemTemplate>
				</asp:TemplateField> 
				<asp:TemplateField HeaderText="ID">            
					<ItemStyle Width="5%" />
					<ItemTemplate>
						<asp:Label ID="Adv_ID" runat="Server" Text='<%#Eval("Adv_ID") %>' ></asp:Label>
					</ItemTemplate>
				</asp:TemplateField>
				 <asp:TemplateField HeaderText="Website">            
					<ItemStyle Width="45%" />
					<ItemTemplate>
					<a href='<%# "EditAdvertise.aspx?Advertise_ID=" + Eval("Adv_ID") %>'>
						<asp:Label ID="Advertise_Adv_Link" runat="Server" Text='<%#Eval("Adv_Link") %>' ></asp:Label>
				    </a>
					</ItemTemplate>
				</asp:TemplateField>  
				 <asp:TemplateField HeaderText="Hình ">            
					<ItemStyle Width="25%" />
					<ItemTemplate>                                   
                    <img src='../Images/Adv/<%#Eval("Adv_Image") %>' height="100" width="90" />                
					</ItemTemplate>
				</asp:TemplateField>     
					
				<asp:TemplateField  HeaderText="Hiển thị">
					<ItemStyle HorizontalAlign="Center" Width="5%" />
					<ItemTemplate>
						<asp:ImageButton ID="btnActive" CommandArgument='<%# Eval("Adv_ID") %>' CommandName="active_Advertise"  ImageUrl="Images/check.gif" runat="server" /></a>                            
					</ItemTemplate>
				</asp:TemplateField>     
				
				<asp:TemplateField >
					<ItemStyle Width="25%" />
					<HeaderTemplate>
					<asp:Label ID="Label3" runat="server" Text="Chức năng" ></asp:Label>                   
					</HeaderTemplate>
					<ItemTemplate>                                
						<asp:HyperLink ID="lnkEdit" runat="server" Font-Bold="true" NavigateUrl='<%# "EditAdvertise.aspx?Advertise_ID=" + Eval("Adv_ID") %>'>
							<asp:Image ID="ImageEdit" ToolTip="Sửa thông tin" runat="server" ImageUrl="Images/edit.gif" />
						</asp:HyperLink>                                
						 <asp:ImageButton ID="btnDelete" CommandArgument='<%# Eval("Adv_ID") %>' CommandName="delete_Advertise"  ImageUrl="Images/delete.gif" runat="server"  
						 OnClientClick = "javascript:return confirm('Bạn có chắc chắn không ?');"/>                                              
						 
					</ItemTemplate>
					<ItemStyle Wrap="False" />
				</asp:TemplateField>
			</Columns>      
			<PagerSettings FirstPageText="Trang đầu" LastPageText="Trang cuối" NextPageText="&gt;&gt;"
			  PageButtonCount="5" PreviousPageText="&lt;&lt;" />     
			<pagerstyle backcolor="#F7F7DE" forecolor="Black" horizontalalign="Right" />
			<RowStyle BorderColor="Black" BorderWidth="1px" BackColor="#F7F7DE" />
			<FooterStyle BackColor="#CCCC99" />
			<selectedrowstyle backcolor="#CE5D5A" font-bold="True" forecolor="White" />
			<headerstyle backcolor="#6B696B" font-bold="True" forecolor="White" />
			<alternatingrowstyle backcolor="White" />
		    <SortedAscendingCellStyle BackColor="#FBFBF2" />
            <SortedAscendingHeaderStyle BackColor="#848384" />
            <SortedDescendingCellStyle BackColor="#EAEAD3" />
            <SortedDescendingHeaderStyle BackColor="#575357" />
		</asp:GridView>
		</td>
	</tr>
<!--Start button-->
 <tr  style="width:100%;">
        <td align="right">
			<a href="EditAdvertise.aspx" >Thêm mới</a>&nbsp;&nbsp;
            <a onclick="CheckAll();" href="#" >Chọn hết</a>&nbsp;&nbsp;
            <a onclick="UnCheckAll();" href="#">Bỏ chọn</a>&nbsp;&nbsp; &nbsp;&nbsp;          
            <asp:LinkButton ID="btnDeleteAll" runat="server" OnClick="btnDeleteAll_Click" 
			OnClientClick= "javascript:return confirm('Bạn có chắc chắn không ?');" >Xóa hết</asp:LinkButton>
        </td>        
  </tr>
<!--End button-->  
</table>
<script language="javascript" type="text/javascript">        
        function CheckAll()
        {            
            for(i=0;i<document.getElementsByTagName("input").length;i++)
            {
                if(document.getElementsByTagName("input")[i].type == "checkbox")
                {
                    document.getElementsByTagName("input")[i].checked = true;                   
                }
            }
            return true;
        }
        
        function UnCheckAll()
        {            
            for(i=0;i<document.getElementsByTagName("input").length;i++)
            {
                if(document.getElementsByTagName("input")[i].type == "checkbox")
                {
                    document.getElementsByTagName("input")[i].checked = false;                   
                }
            }
            return true;
        }
    </script>
</asp:Content>


